package com.ocom.webapi.feign;

import com.ocom.common.constant.CompanyServiceUrl;
import com.ocom.common.constant.HumanServiceUrl;
import com.ocom.common.dto.*;
import com.ocom.common.entity.company.*;
import com.ocom.common.entity.master.EntityMngUserInfo;
import com.ocom.common.entity.master.EntityWechatAppInfo;
import com.ocom.common.entity.noticeBoard.EntityNoticeBoardInfo;
import com.ocom.common.entity.pay.EntityAppConfig;
import com.ocom.common.request.IdRequest;
import com.ocom.common.request.company.*;
import com.ocom.common.request.ugcapi.GzhUserLeaveList;
import com.ocom.common.request.web.WebAppConfigGetFuncVo;
import com.ocom.common.resp.Result;
import com.ocom.common.vo.CompanyListInfoVo;
import com.ocom.common.vo.company.ComLoginAuthCodeRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

@FeignClient(value = "company")
public interface CompanyClientService {
    /**
     * 获取单位信息
     * */
    @PostMapping(CompanyServiceUrl.URL_GetCompanyInfo)
    public Result GetCompanyInfo(@RequestBody Map<String, Object> map);


    /**
     * 添加单位
     * */
    @PostMapping(CompanyServiceUrl.URL_AddCompanyInfo)
    public Result AddCompanyInfo(@RequestBody Map<String, Object> map);

    /**
     * 更新单位信息
     *
     * @param companyInfoDto*/
    @PostMapping(CompanyServiceUrl.URL_UpdateCompanyInfo)
    public Result UpdateCompanyInfo(@RequestBody CompanyInfoDto companyInfoDto);


    /**
     * 获取单位列表信息
     * */
    @Deprecated
    @GetMapping(CompanyServiceUrl.URL_GetCompanyListInfo)
    Result GetCompanyListInfo(@Valid @RequestParam(required = false) Long comId,
                              @Valid @RequestParam(required = false) String comName,
                              @Valid @RequestParam(required = false) Integer agentId,
                              @RequestParam(value = "only" ,defaultValue = "0") Integer only,
                              @RequestParam("page") Integer page,
                              @RequestParam("size") Integer size);


    @PostMapping(CompanyServiceUrl.URL_GetCompanyListInfo)
    Result GetCompanyListInfo(@RequestBody CompanyListInfoVo companyListInfoVo);



    /**
     * 获取管理员用户信息
     * */
    @PostMapping(CompanyServiceUrl.URL_GetMngUserInfo)
    public Result GetMngUserInfo(@RequestBody Map<String, Object> map);

//    /**
//     * 获取单位下用户数
//     * */
//    @GetMapping(CompanyServiceUrl.URL_GetCompanyPersonNum)
//    public Result GetCompanyPersonNum(@RequestParam Long comId,@RequestParam  String deptId,@RequestParam  Long status);
//
    /**
     * 添加管理员
     * */
    @PostMapping(CompanyServiceUrl.URL_AddCompanyAdminInfo)
    public Result AddCompanyAdminInfo(@RequestBody Map<String, Object> map);

    /**
     * 更新管理员信息
     *
     * @param map*/
    @PostMapping(CompanyServiceUrl.URL_UpdateMngUserInfo)
    public Result UpdateMngUserInfo(@RequestBody Map<String, Object> map);


    /**
     * 获取升级文件记录(getMjOsVerInfo)
     *
     * @param map*/
    @PostMapping(CompanyServiceUrl.URL_GetMjOsVerInfo)
    public Result GetMjOsVerInfo(@RequestBody Map<String, Object> map);

    /**
     * 保存升级文件记录(addMjOsVerInfo)
     *
     * @param map*/
    @PostMapping(CompanyServiceUrl.URL_AddMjOsVerInfo)
    public Result AddMjOsVerInfo(@RequestBody Map<String, Object> map);


    /**
     * 保存升级文件记录(addMjOsVerInfo)
     *
     * @param map*/
    @PostMapping(CompanyServiceUrl.URL_UpdateMjOsVerInfo)
    public Result UpdateMjOsVerInfo(@RequestBody Map<String, Object> map);


    /**
     * 获取可升级文件版本(getMjOsVerUp)
     *
     * @param map*/
    @PostMapping(CompanyServiceUrl.URL_GetMjOsVerUp)
    public Result GetMjOsVerUp(@RequestBody Map<String, Object> map);


    //获取一个单位信息
    @PostMapping(CompanyServiceUrl.URL_GetCompanyListInfoOne)
    Result GetCompanyListInfoOne(@RequestParam("companyId") Long companyId);


    @PostMapping(CompanyServiceUrl.URL_GetCompanyKeyInfo)
    public Result getCompanyKeyInfo(@RequestParam("comId") Long comId,@RequestParam("page") Integer page,
                                 @RequestParam("size")Integer size);

    @PostMapping(CompanyServiceUrl.URL_UpdateCompanyCommKey)
    public Result updateCompanyCommKey(@RequestParam("comId") Long comId,@RequestParam("commKey") String commKey);

    /**
     * 获取管理员信息
     * @param userName
     * @return
     */
    @GetMapping(CompanyServiceUrl.URL_GetMngUserInfoByName)
    Result<EntityMngUserInfo> GetMngUserInfo(@RequestParam("userName")String userName);


    @PostMapping(CompanyServiceUrl.URL_getCompanyListByAgentId)
    Result getCompanyListByAgentId(@RequestParam("agentId")Long agentId);

    /**
     * 2.21.手机号获取可管理单位（getCompanyListByPhone）
     * */
    @GetMapping(CompanyServiceUrl.URL_GetCompanyListByPhone)
    public Result GetCompanyListByPhone(@RequestParam("phone")String phone);

    /**
     * 保存充值记录
     * @param entityImportLog
     * @return
     */
    @PostMapping(CompanyServiceUrl.URL_importLog)
    public Result importLog(@RequestBody EntityImportLog entityImportLog);

    /**
     * 单位服务 公众号配置
     */
    @PostMapping(CompanyServiceUrl.URL_getAppFunc)
    public Result getAppFunc(@RequestBody WebAppConfigGetFuncVo webAppConfigGetFuncVo);

    @PostMapping(CompanyServiceUrl.URL_setAppFunc)
    public Result setAppFunc(@RequestBody EntityAppConfig entityAppConfig);

    @PostMapping(CompanyServiceUrl.URL_getAppInfo)
    public Result getAppInfo(@RequestParam("comId")Long comId , @RequestParam("appId")String appId);

    @PostMapping(CompanyServiceUrl.URL_setAppInfo)
    public Result setAppInfo(@RequestBody EntityWechatAppInfo entityWechatAppInfo);

    @PostMapping(CompanyServiceUrl.URL_getAppInfoByName)
    public Result getAppInfoByName(@RequestParam("appName")String appName);

    @PostMapping(CompanyServiceUrl.URL_getCompanyListByAgentGzh)
    public Result getCompanyListByAgentGzh(@RequestParam("agentAppid")String agentAppid,@RequestParam("bingRegister")Integer bingRegister);

    @PostMapping(CompanyServiceUrl.URL_getPersonListByOpenid)
    public Result getPersonListByOpenid(@RequestParam("openid")String openid,@RequestParam("appid")String appid);

    @PostMapping(CompanyServiceUrl.URL_urlBindRegister)
    public Result urlBindRegister(@RequestParam("bind") Integer bind,
                                  @RequestParam("register") Integer register);

    @PostMapping(CompanyServiceUrl.URL_getGzhListOfCom)
    public Result getGzhListOfCom(@RequestBody GetGzhListOfComRequest request);

    @PostMapping(CompanyServiceUrl.URL_getGzhCodeOfCom)
    public Result getGzhCodeOfCom(@RequestParam("comId")Long comId);

    //获取单位简表
    @PostMapping(CompanyServiceUrl.URL_getCompanySummary)
    public Result getCompanySummary(@RequestBody GetCompanySummaryRequest getCompanySummaryRequest);

    /**
     * 5.2获取单位当前数据（getUnitCurrentData）
     */
    @PostMapping(CompanyServiceUrl.URL_getUnitCurrentData)
    public Result getUnitCurrentData(@RequestParam("subDb")Integer subDb);


    /**
     * 5.4修改单位使用权限（setUnitPara）
     */
    @PostMapping(CompanyServiceUrl.URL_setUnitPara)
    public Result setUnitPara(@RequestBody SetUnitParaRequest request);


    /**
     * 5.5获取分库当前数据（getSubDbCurrentData）
     */
    @PostMapping(CompanyServiceUrl.URL_getSubDbCurrentData)
    public Result getSubDbCurrentData(@RequestParam("subDb")Integer subDb);


    /**
     *   //5.7获取分库的单位范围（getSubDbComId）
     */
    @PostMapping(CompanyServiceUrl.URL_getSubDbComId)
    public Result getSubDbComId(@RequestParam("subDb")Integer subDb);

    /**
     * 查询单位角色（getCompanyRoleList）
     */
    @PostMapping(CompanyServiceUrl.URL_getCompanyRole)
    public Result getCompanyRole(GetCompanyRoleListDto dto);

    /**
     * 4.22添加单位角色（addCompanyRole）
     */
    @PostMapping(CompanyServiceUrl.URL_addCompanyRole)
    public Result addCompanyRole(@RequestParam("companyId") Long companyId, @RequestBody CompanyRoleDto dto);

    /**
     * 4.23更新单位角色名称（modifyCompanyRole）
     */
    @PostMapping(CompanyServiceUrl.URL_modifyCompanyRole)
    public Result modifyCompanyRole(@RequestParam("companyId")Long companyId, @RequestParam("roleId")Long roleId, @RequestParam("roleName")String roleName);

    /**
     * 4.24删除自定义角色（delCompanyRole）
     */
    @PostMapping(CompanyServiceUrl.URL_delCompanyRole)
    public Result delCompanyRole(@RequestParam("companyId")Long companyId, @RequestParam("roleId")Long roleId);

    /**
     * 3.22获取单位功能配置列表(getCompanyConfig)
     */
    @PostMapping(CompanyServiceUrl.URL_getCompanyConfig)
    public Result<List<EntityCompanyConfig>> getCompanyConfig(@RequestParam("comId") Long companyId, @RequestParam("tab")String tab);


    /**
     * 3.23新增单位功能配置(addCompanyConfig)
     */
    @PostMapping(CompanyServiceUrl.URL_addCompanyConfig)
    public Result addCompanyConfig(@RequestBody EntityCompanyConfig entityCompanyConfig);

    /**
     * 3.24更新单位功能配置(updateCompanyConfig)
     */
    @PostMapping(CompanyServiceUrl.URL_updateCompanyConfig)
    public Result updateCompanyConfig(@RequestBody EntityCompanyConfig entityCompanyConfig);
    /**
     * 3.25删除单位功能配置(removeCompanyConfig)
     */
    @PostMapping(CompanyServiceUrl.URL_removeCompanyConfig)
    public Result removeCompanyConfig(@RequestParam("comId") Long companyId, @RequestParam("tab")String tab);


    /**
     * 6.23生成单位登录验证码（getComLoginAuthCode）
     */
    @PostMapping(CompanyServiceUrl.URL_getComLoginAuthCode)
    public Result getComLoginAuthCode(@RequestBody ComLoginAuthCodeRequest request) ;



    //6.5添加平台通讯接口（addDockApi）
    @PostMapping(CompanyServiceUrl.Url_addDockApi)
    public Result addDockApi(@RequestBody EntityDockApi request);

    //6.4获取通讯接口列表（getDockApiList）
    @PostMapping(CompanyServiceUrl.Url_getDockApiList)
    public Result getDockApiList(@RequestBody DockApiListDto request);

    //6.6修改平台通讯接口（updateDockApi）
    @PostMapping(CompanyServiceUrl.Url_updateDockApi)
    public Result updateDockApi(@RequestBody EntityDockApi request);

    //6.7设置通讯接口URL（setDockApiUrl）
    @PostMapping(CompanyServiceUrl.Url_setDockApiUrl)
    public Result setDockApiUrl(@RequestBody DockUrlSetDto request);

    //6.8获取通讯服务商列表（getDockServerList）
    @PostMapping(CompanyServiceUrl.Url_getDockServerList)
    public Result getDockServerList(@RequestBody DockServerListDto request);

    //6.9添加平台通讯服务商（addDockServer）
    @PostMapping(CompanyServiceUrl.Url_addDockServer)
    public Result addDockServer(@RequestBody EntityDockServer request);

    //6.10修改平台通讯服务商（updateDockServer）
    @PostMapping(CompanyServiceUrl.Url_updateDockServer)
    public Result updateDockServer(@RequestBody EntityDockServer request);

    //6.11获取单位平台对接列表（getComDockList）
    @PostMapping(CompanyServiceUrl.Url_getComDockList)
    public Result getComDockList(@RequestBody CompanyDockListDto request);

    //6.12添加单位平台对接（addComDock）
    @PostMapping(CompanyServiceUrl.Url_addComDock)
    public Result addComDock(@RequestBody EntityCompanyDock request);

    //6.13修改单位平台对接（updateComDock）
    @PostMapping(CompanyServiceUrl.Url_updateComDock)
    public Result updateComDock(@RequestBody EntityCompanyDock request);

    //6.14删除单位平台对接（removeComDock）
    @PostMapping(CompanyServiceUrl.Url_removeComDock)
    public Result removeComDock(@RequestBody EntityCompanyDock request);

    //6.15读取通讯接口密钥（getDockKey）
    @PostMapping(CompanyServiceUrl.Url_getDockKey)
    public Result getDockKey(@RequestBody DockKeyDto request);

    //6.16保存通讯接口密钥（saveDockKey）
    @PostMapping(CompanyServiceUrl.Url_saveDockKey)
    public Result saveDockKey(@RequestBody EntityDockKey request);

    //6.17读取通讯接口URL（getDockApiUrl）
    @PostMapping(CompanyServiceUrl.URL_getDockApiUrl)
    public Result getDockApiUrl(@RequestBody GetDockApiUrlRequest request);

    //6.18读取通讯接口配置（getDockApiConfig）
    @PostMapping(CompanyServiceUrl.Url_getDockApiConfig)
    public Result getDockApiConfig(@RequestBody GetDockApiConfigDto request);

    //6.19保存通讯接口配置（saveDockApiConfig）
    @PostMapping(CompanyServiceUrl.Url_saveDockApiConfig)
    public Result saveDockApiConfig(@RequestBody EntityComDockApi request);

    //TODO
    @PostMapping(CompanyServiceUrl.Url_newMd5Key)
    public Result newMd5Key(@RequestBody Object request);

    //TODO
    @PostMapping(CompanyServiceUrl.Url_newRsa)
    public Result newRsa(@RequestBody Object request);

    //6.28获取平台单位列表（getDockComList）
    @PostMapping(CompanyServiceUrl.Url_getDockComList)
    public Result getDockComList(@RequestBody Object request);

    @PostMapping(CompanyServiceUrl.URL_getComDockPageList)
    public Result getComDockPageList(@RequestParam("comId")Long comId) ;

    @PostMapping(CompanyServiceUrl.URL_getSeverReplyApiPara)
    public Result getSeverReplyApiPara(@RequestBody GetSeverReplyApiParaRequest request) ;

    @PostMapping(HumanServiceUrl.URL_getFeatureVersion)
    public Result getFeatureVersion(@RequestParam("companyId") Long companyId);


    @PostMapping(CompanyServiceUrl.URL_getComRequest)
    public Result getComRequest(@RequestBody GetComRequestRequest request) ;

    @PostMapping(CompanyServiceUrl.URL_getNoticeBoardList)
    public Result getNoticeBoardList(@RequestBody GetNoticeBoardListRequest request);

    @PostMapping(CompanyServiceUrl.URL_addNoticeBoard)
    public Result addNoticeBoard(@RequestBody EntityNoticeBoardInfo request);

    @PostMapping(CompanyServiceUrl.URL_modifyNoticeBoard)
    public Result updateNoticeBoard(@RequestBody EntityNoticeBoardInfo request);

    @PostMapping(CompanyServiceUrl.URL_deleteNoticeBoard)
    public Result deleteNoticeBoard(@RequestBody IdRequest idRequest);

    @PostMapping(CompanyServiceUrl.URL_getNoticeBoardByCom)
    Result homeNoticeOnShow(@RequestBody @Validated GetNoticeBoardByComRequest getNoticeBoardByComRequest);

    @PostMapping(CompanyServiceUrl.URL_productSuggestionPage)
    Result productSuggestionPage(@RequestBody ProductSuggestionPageRequest request);

    @PostMapping(CompanyServiceUrl.URL_productSuggestionUpdate)
    Result productSuggestionUpdate(@RequestBody ProductSuggestionRequest request);

    @PostMapping(CompanyServiceUrl.URL_productSuggestionDelete)
    Result productSuggestiondelete(@RequestBody ProductSuggestionRequest request);

    @PostMapping(CompanyServiceUrl.URL_account)
    Result selectAccountsByPhone(@RequestBody MngAccountInfoRequest request);

    @PostMapping(CompanyServiceUrl.URL_addMngAccount)
    Result addMngAccount(@RequestBody MngAccountInfoRequest mngAccountInfoRequest);

    @PostMapping(CompanyServiceUrl.URL_getFlowListByCom)
    Result getFlowListByCom(@RequestBody GetFlowListByComRequest getFlowListByComRequest);

    @PostMapping(CompanyServiceUrl.URL_newComFlow)
    Result newComFlow(@RequestBody NewComFlowRequest newComFlowRequest);

    @PostMapping(CompanyServiceUrl.URL_updateComFlow)
    Result updateComFlow(@RequestBody UpdateComFlowRequest updateComFlowRequest);

    @PostMapping(CompanyServiceUrl.URL_removeComFlow)
    Result removeComFlow(@RequestBody RemoveComFlowRequest removeComFlowRequest);

    @PostMapping(CompanyServiceUrl.URL_getApproverListByFlow)
    Result getApproverListByFlow(@RequestBody GetApproverListByFlowRequest getApproverListByFlowRequest);


    @PostMapping(CompanyServiceUrl.URL_newFlowApprover)
    Result newFlowApprover(@RequestBody NewFlowApproverRequest newFlowApproverRequest);

    @PostMapping(CompanyServiceUrl.URL_updateFlowApprover)
    Result updateFlowApprover(@RequestBody UpdateFlowApproveRequest updateFlowApproveRequest);

    @PostMapping(CompanyServiceUrl.URL_removeFlowApprover)
    Result removeFlowApprover(@RequestBody RemoveFlowApproverRequest removeFlowApproverRequest);

    @PostMapping(CompanyServiceUrl.URL_getPushListByFlow)
    Result getPushListByFlow(@RequestBody GetPushListByFlowRequest getPushListByFlowRequest);

    @PostMapping(CompanyServiceUrl.URL_newFlowPush)
    Result newFlowPush(@RequestBody NewFlowPushRequest newFlowPushRequest);

    @PostMapping(CompanyServiceUrl.URL_updateFlowPush)
    Result updateFlowPush(@RequestBody UpdateFlowPushRequest updateFlowPushRequest);

    @PostMapping(CompanyServiceUrl.URL_removeFlowPush)
    Result removeFlowPush(@RequestBody RemoveFlowPushRequest removeFlowPushRequest);

    @PostMapping(CompanyServiceUrl.URL_getFlowInstanceList)
    Result getFlowInstanceList(@RequestBody GetFlowInstanceListRequest getFlowInstanceListRequest);

    @PostMapping(CompanyServiceUrl.URL_getLoginCompanyList)
    Result getLoginCompanyList(@RequestBody GetLoginCompanyListRequest request);

    @PostMapping(CompanyServiceUrl.URL_leavelApplyList)
    public Result leavelApplyList(@RequestBody GzhUserLeaveList request);
}
